
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="../admin/css/style.css" rel="stylesheet" type="text/css" />
    <link href="css/select.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="js/jquery.idTabs.min.js"></script>
<script type="text/javascript" src="../admin/js/jquery.js"></script>
    <script type="text/javascript" src="js/select-ui.min.js"></script>
    <script type="text/javascript" src="editor/kindeditor.js"></script>
    <style>
        #changetr:hover{background:white;}
    </style>
<script type="text/javascript">
    $(document).ready(function(){
        $(".click").click(function(){
            $(".tip").fadeIn(200);
        });

        $(".tiptop a").click(function(){
            $(".tip").fadeOut(200);
        });

        $(".sure").click(function(){
            $(".tip").fadeOut(100);
        });

        $(".cancel").click(function(){
            $(".tip").fadeOut(100);
        });

    });
</script>
    <script type="text/javascript">
        KE.show({
            id : 'content7',
            cssPath : './index.css'
        });
    </script>

    <script type="text/javascript">
        $(document).ready(function(e) {

            $(".select3").uedSelect({
                width : 152
            });
        });
    </script>
</head>
<body class="sarchbody">
	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="#">首页</a></li>
    <li><a href="#">数据表</a></li>
    <li><a href="#">基本内容</a></li>
    </ul>
    </div>

    <div class="formbody">


    <div id="usual1" class="usual">


    <form id="searchForm" method="post" action="./cuslist.php">
        <ul class="seachform1">

            <li><label>客户名称</label><input name="cus_fname" type="text" class="scinput1" /></li>
            <li><label>客户编号</label><input name="cus_number" type="text" class="scinput1" /></li>
            <li style="width:80px;"><label></label><input name="" type="button" class="scbtn" value="查询"/></li>
            <li><input name="" type="button" class="scbtn2" value="导出"/></li>
        </ul>
</form>
        <script language="javascript">
            $(document).ready(function()
            {
                $(".scbtn1").click(function()
                {
                    if( $(".seachform2").hasClass("hideclass") )
                    {
                        $(".seachform2").removeClass("hideClass");
                    }
                    else
                    {
                        $(".seachform2").addClass("hideClass");
                    }
                });
                $('.scbtn').bind('click',function(){
                    $('#searchForm').submit();
                });
            });


        </script>


        <script type="text/javascript">
            $(document).ready(function(){
                $(".scbtn1").click(function(){
                    $(".seachform2").fadeIn(200);
                });


            });
            </script>
        <div style="height:10px;"></div>
            <div class="rightinfo">
    <div class="tools">
        <ul class="toolbar">
        <li class="cus_info_add"><span><img src="../admin/images/t01.png" /></span>添加</li>
        <li class="cus_info_edit"><span><img src="../admin/images/t02.png" /></span>修改</li>
        <li  id="cus_info_del"><span><img src="../admin/images/t03.png" /></span>删除</li>
        <li><span><img src="../admin/images/t04.png" /></span>统计</li>
        </ul>
        <ul class="toolbar1">
        <li><span><img src="../admin/images/t05.png" /></span>设置</li>
        </ul>
    </div>
               <div style="width:100%;height:450px; overflow:auto;padding:0px; margin: 0px; ">
    <table class="tablelist" ">
    	<thead >
    	<tr >
        <th><input name="" type="checkbox" value="" checked="checked"/></th>
        <th>编号<i class="sort"><img src="images/px.gif" /></i></th>
        <th>客户编号<i class="sort"></th>
        <th>会员编号</th>
        <th>客户全称</th>
        <th>客户简称</th>
        <th>客户类别</th>
        <th>负责人</th>
        <th>性别</th>
        <th>地区</th>
        <th>省市</th>
        <th>地址</th>
        <th>手机</th>
        <th>身份证</th>
        <th>复印件</th>
        <th>生日</th>
        <th>EMAIL</th>
        <th>公司电话</th>
        <th>公司传真</th>
        <th>获取三证</th>
        <th>委托书</th>
        <th>业务人员</th>
        <th>业务经理</th>
        <th>客服人员</th>
        <th>备注</th>
        <th>添加时间</th>
        <th>操作</th>
        </tr>
        </thead>
        <tbody>
    <?php
        require '../lib/db.php';
        require '../lib/Page.class.php';
        //接收搜索条件
        if(isset($_POST['cus_fname']) && $_POST['cus_fname']!=''){
            $cus_fname = $_POST['cus_fname'];
            $where1 = "cus_fname like '%$cus_fname%'";
        }else{
            $where1 = 1;
        }
        if(isset($_POST['cus_number']) && $_POST['cus_number']!=''){
            $cus_number = $_POST['cus_number'];
            $where2 = "cus_number like'%$cus_number%'";
        }else{
            $where2 = 1;
        }

        //分页

        $sql = "select count(*) as num from mf_customer where $where1 and $where2";
        open_mysql_connect();
        $res = mysql_query($sql);
        $row = mysql_fetch_assoc($res);
        if($row['num']==0){
            echo "<tr id='changetr' ><td colspan='27' style='font-size:18px; height:200px; text-aligh:center;border-style:none;'>抱歉，没有搜索到相关信息</td></tr>";

            exit;
        }
        $res = db_exec_query($sql);
        foreach($res as $v){
            $count = $v['num'];
        }
        $listRows = 20;
        $page = new Page($count,$listRows,$_SERVER['PHP_SELF']);
        $pageStr = $page->show();
        $firstRow = $page->firstRow;
        $sql = "select * from mf_customer where $where1 and $where2 order by cus_id desc limit $firstRow,$listRows";
        //echo $sql;exit;
        $data_cus = db_exec_query($sql);
        /*if(count($data_cus)==0){

            echo "<tr id='changetr' style='text-align:center;'><td colspan='17' style='font-size:18px; height:200px; text-aligh:center;'>抱歉，没有搜索到相关信息</td></tr>";

            exit;
        }*/
        foreach($data_cus as $v) {

    ?>
        <tr>
        <td><input name="id[]" type="checkbox" value="<?php echo $v['cus_id'];?>" /></td>
        <td><?php echo $v['cus_id'];?></td>
        <td class='details' content="<?php echo $v['cus_number'];?>"><?php echo Mb_substr($v['cus_number'],0,9).'..';?></td>
        <td class='details' content="<?php echo $v['cus_vip_number'];?>"><?php echo '..'.substr($v['cus_vip_number'],6,8);?></td>
        <td  class='details' content="<?php echo '全称：'.$v['cus_fname'];?>"><?php echo Mb_substr($v['cus_fname'],0,9).'..';?></td>
        <td><?php echo $v['cus_aname'];?></td>
        <td><?php echo $v['cus_cate'];?></td>
        <td><?php echo $v['cus_linkman'];?></td>
        <td><?php echo $v['cus_sex'] ?'女' :'男';?></td>
        <td><?php echo $v['cus_area'];?></td>
        <td class='details' content="<?php echo $v['cus_province'];?>"><?php echo Mb_substr($v['cus_province'],0,13).'..';?></td>
        <td  class='details' content="<?php echo $v['cus_address'];?>"><?php echo Mb_substr($v['cus_address'],0,15).'..';?></td>
        <td><?php echo $v['cus_phone'];?></td>
        <td class='details' content="<?php echo $v['cus_identity_num'];?>"><?php echo substr($v['cus_identity_num'],0,6).'..';?></td>
        <td><?php echo $v['cus_iscopy']?'有' :'无';?></td>
        <td><?php echo $v['cus_birthday'];?></td>
        <td class='details' content="<?php echo $v['cus_email'];?>"><?php echo substr($v['cus_email'],0,9);?></td>
        <td><?php echo $v['cus_tel'];?></td>
        <td class='details' content="<?php echo $v['cus_fax'];?>"><?php echo Mb_substr($v['cus_fax'],0,9);?></td>
        <td class='details' content="<?php echo $v['cus_cert'];?>"><?php echo $v['cus_cert']=='无'?'无':Mb_substr($v['cus_cert'],0,9).'..';?></td>
        <td><?php echo $v['cus_isget']?'已获取' :'未获取';?></td>
        <td><?php echo $v['cus_business_p'];?></td>
        <td><?php echo $v['cus_business_m'];?></td>
        <td><?php echo $v['cus_service'];?></td>
        <td class='details' content="<?php echo $v['cus_remark'];?>"><?php echo Mb_substr($v['cus_remark'],0,9).'..';?></td>
        <td><?php echo date('Y-m-d',$v['cus_addtime']);?></td>
        <td><a href="./edit001.php?id=<?php echo $v['cus_id'];?>" class="tablelink">查看</a>     <a href="javascript://"   style="color:#EB5409;" class="deltable"  tag="<?php echo $v['cus_id'];?>"> 删除</a></td>
        </tr>
    <?php }?>
    <script>
        $(".deltable").bind('click',function(){
            if(confirm('确认删除吗？')){
                var ids = $(this).attr('tag');
                $.ajax({
                    type:"post",
                    data:{ids:ids},
                    url:"../api/customer.php?action=del",
                    success:function(result){
                        if(result){
                            alert('删除成功');
                            window.location.href='./cuslist.php'
                        }else{
                            alert('删除失败');
                        }
                    },
                    error:function(){
                        alert("提交错误");
                    }
                });
            }
        })
    </script>
    <div class="mydiv" style="background-color: #fff8f5;font-size:18px; position: absolute;height:30px;line-height: 30px;"></div>
    <script>
        //鼠标悬浮事件
        $(".details").hover(function(event){
            $thiss=$(this);
            $locx=event.pageX;
            $locy=event.pageY;
            $(".mydiv").css("left",$locx+8).css("top",$locy).text($thiss.attr("content"));
            $setTime=setTimeout(function(){


                $(".mydiv").css("left",$locx+8).css("top",$locy).text($thiss.attr("content")).show();
            },500);
        },function(){
            $(".mydiv").slideUp();
            clearTimeout($setTime);
        })
    </script>
        </tbody>
    </table>
</div>

    <?php echo $pageStr;?>


    <div class="tip">
    	<div class="tiptop"><span>提示信息</span><a></a></div>

      <div class="tipinfo">
        <span><img src="../admin/images/ticon.png" /></span>
        <div class="tipright">
        <p>是否确认对信息的修改 ？</p>
        <cite>如果是请点击确定按钮 ，否则请点取消。</cite>
        </div>
        </div>

        <div class="tipbtn">
        <input name="" type="button"  class="sure" value="确定" />&nbsp;
        <input name="" type="button"  class="cancel" value="取消" />
        </div>

    </div>




    </div>

    <script type="text/javascript">
    $('.tablelist tbody tr:odd').addClass('odd');
	</script>

<script>
    $(function(){
        $('.cus_info_add').bind('click',function(){
            window.location.href='./add001.html';
        });
        $('.cus_info_edit').bind('click',function(){
            var ck = $(':checkbox:checked');
            if(!ck.length){
                alert('请选择一项');
                return;
            }
            if(ck.length == 1){
                var id = ck.val();
                location.href ='edit001.php?id='+id;
            }else{
                alert('只能选择一项');
            }
        });
        $('#cus_info_del').bind('click',function(){
            var ck = $(':checkbox:checked');
            if(!ck.length){
                alert('请选择一项或多项');
                return;
            }
            if(confirm('确认删除吗?')){
                var id = [];
                for(var i=0;i<ck.length;i++){
                    id.push(ck[i].value);
                }
                var ids = id.toString();
                $.ajax({
                    type:"post",
                    data:{ids:ids},
                    url:"../api/customer.php?action=del",
                    success:function(result){
                        if(result){
                            alert('删除成功');
                            window.location.href='./cuslist.php'
                        }else{
                            alert('删除失败');
                        }
                    },
                    error:function(){
                        alert("提交错误");
                    }
                });
            }

        });
    })

</script>
</div>
</body>

</html>
